/**
 * 发送线程负责从发送队列取出用户数据报，并根据端口地址发送回去
 * */
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class SendThread extends Thread{

    @Override
    public void run(){
//        DatagramSocket socket = null;
//        int sendport=6790;//服务器发送端口
        try{
            //socket=new DatagramSocket(sendport);
            while (true){
                DatagramPacket packet = Server.sendQueue.take();
                String s = new String(packet.getData());
                System.out.println("现在准备发送回的数据"+s);
                //System.out.println("客户端的端口地址为："+packet.getPort());
                Server.socket.send(packet);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
